package Client;

/**
 * The Universal Product Code
 * 
 * @author Vinicius Hisao Suzuki (vinicius@hisao.com.br)
 * 
 */

public class UPC {

	private static int lastUPC = 0;

	private int UPC;

	/**
	 * Requests new UPC
	 * 
	 * @return unique UPC
	 */
	public static int getNewUPC() {
		if (lastUPC == 0) {
			// TODO must get the last from server
			return lastUPC++;
		} else {
			return lastUPC++;
		}
	}

	/**
	 * The UPC of this object
	 * 
	 * @return
	 */
	public int getUPC() {
		return this.UPC;
	}

	/**
	 * Constructor
	 * 
	 * @param UPC
	 *            usually, you can call getNewUPC if this is a new UPC
	 */
	public UPC(int UPC) {
		this.UPC = UPC;
	}

}
